package oom;

import java.nio.ByteBuffer;

/**
 * 跟踪对外内存
 * -Xmx20m -XX:MaxDirectMemorySize=10M
 */
public class DirectMemoryTrace {
    public static void main(String[] args) throws InterruptedException {
        int i = 0;
        for(;;) {
            ByteBuffer.allocateDirect(1024 * 1024);
            System.out.println(i ++);
            Thread.sleep(1000);
        }
    }
}
